package asn.match.model;

// Generated 15 juin 2014 03:03:18 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * InternalMessage generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "internal_message", catalog = "muslima_sphere")
public class InternalMessage implements java.io.Serializable {

	private Integer idInternalMessage;
	private MemberAccount memberAccountBySourceMemberId;
	private MemberAccount memberAccountByTargetMemberId;
	private InternalMessage internalMessage;
	private String type;
	private byte[] content;
	private Date sendDatetime;
	private Date readDatetime;
	private Date createdAt;
	private Date modifiedAt;
	private Set<InternalMessage> internalMessages = new HashSet<InternalMessage>(
			0);

	public InternalMessage() {
	}

	public InternalMessage(MemberAccount memberAccountBySourceMemberId,
			String type, byte[] content, Date sendDatetime, Date readDatetime,
			Date createdAt, Date modifiedAt) {
		this.memberAccountBySourceMemberId = memberAccountBySourceMemberId;
		this.type = type;
		this.content = content;
		this.sendDatetime = sendDatetime;
		this.readDatetime = readDatetime;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
	}

	public InternalMessage(MemberAccount memberAccountBySourceMemberId,
			MemberAccount memberAccountByTargetMemberId,
			InternalMessage internalMessage, String type, byte[] content,
			Date sendDatetime, Date readDatetime, Date createdAt,
			Date modifiedAt, Set<InternalMessage> internalMessages) {
		this.memberAccountBySourceMemberId = memberAccountBySourceMemberId;
		this.memberAccountByTargetMemberId = memberAccountByTargetMemberId;
		this.internalMessage = internalMessage;
		this.type = type;
		this.content = content;
		this.sendDatetime = sendDatetime;
		this.readDatetime = readDatetime;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
		this.internalMessages = internalMessages;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_internal_message", unique = true, nullable = false)
	public Integer getIdInternalMessage() {
		return this.idInternalMessage;
	}

	public void setIdInternalMessage(Integer idInternalMessage) {
		this.idInternalMessage = idInternalMessage;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "source_member_id", nullable = false)
	public MemberAccount getMemberAccountBySourceMemberId() {
		return this.memberAccountBySourceMemberId;
	}

	public void setMemberAccountBySourceMemberId(
			MemberAccount memberAccountBySourceMemberId) {
		this.memberAccountBySourceMemberId = memberAccountBySourceMemberId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "target_member_id")
	public MemberAccount getMemberAccountByTargetMemberId() {
		return this.memberAccountByTargetMemberId;
	}

	public void setMemberAccountByTargetMemberId(
			MemberAccount memberAccountByTargetMemberId) {
		this.memberAccountByTargetMemberId = memberAccountByTargetMemberId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "message_parent_id")
	public InternalMessage getInternalMessage() {
		return this.internalMessage;
	}

	public void setInternalMessage(InternalMessage internalMessage) {
		this.internalMessage = internalMessage;
	}

	@Column(name = "type", nullable = false, length = 14)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "content", nullable = false)
	public byte[] getContent() {
		return this.content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "send_datetime", nullable = false, length = 19)
	public Date getSendDatetime() {
		return this.sendDatetime;
	}

	public void setSendDatetime(Date sendDatetime) {
		this.sendDatetime = sendDatetime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "read_datetime", nullable = false, length = 19)
	public Date getReadDatetime() {
		return this.readDatetime;
	}

	public void setReadDatetime(Date readDatetime) {
		this.readDatetime = readDatetime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_at", nullable = false, length = 19)
	public Date getCreatedAt() {
		return this.createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_at", nullable = false, length = 19)
	public Date getModifiedAt() {
		return this.modifiedAt;
	}

	public void setModifiedAt(Date modifiedAt) {
		this.modifiedAt = modifiedAt;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "internalMessage")
	public Set<InternalMessage> getInternalMessages() {
		return this.internalMessages;
	}

	public void setInternalMessages(Set<InternalMessage> internalMessages) {
		this.internalMessages = internalMessages;
	}

}
